#! /bin/sh -vx
# $Id: pdftosrc.test 804 2018-05-17 22:29:15Z karl $
# Copyright 2017 Karl Berry <tex-live@tug.org>
# Copyright 2011 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.

BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_pdftosrc=$BinDir/pdftosrc$ExeExt

# pre-generated test results in the repository are stored in LF
# but the output might be written in CRLF on some platform.
# if 'diff --strip-trailing-cr' is available, exploit it.
# (useful for tests on win32 binaries run on MSYS shell)
DIFF="diff"
$DIFF --strip-trailing-cr $0 $0 \
  && DIFF="diff --strip-trailing-cr" || echo

src=$srcdir/pdftexdir/tests

rm -rf test-13.* test-15.*

cp $src/test-13.pdf .
$_pdftosrc test-13.pdf -1 \
	&& $DIFF test-13.xref $src/test-13.xref \
	|| exit 1

cp $src/test-15.pdf .
$_pdftosrc test-15.pdf -1 \
	&& $DIFF test-15.xref $src/test-15.xref \
	|| exit 2

